package main

import (
	"fmt"
)

func twoSum(nums []int, target int) []int {
	m := make(map[int]int)
	for k, v := range nums {
		res := target - v
		if _, ok := m[res]; ok {
			return []int{m[res], k}
		} else {
			m[v] = k
		}
	}
	return []int{}
}

func main() {
	nums := []int{2, 7, 11, 15}
	target := 9
	result := twoSum(nums, target)
	fmt.Println(result)
}
